home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $LookupTest < prev    next >
Encoding:
Text File  |  1991-09-07  |  825 b   |  31 lines  |  [TEXT/KEEN]

  1. #$LookupTest - try out the "lookup" built-in function, implemented
  2. #by EnterAct. Requires a project with a built dictionary to be open
  3. #at the time - use on any source code from the project.
  4.  
  5.     {
  6.     gsub(/[^A-Za-z_]/, " ")#crude, but this is just a test
  7.     for (i = 1; i <= NF; ++i)
  8.         {
  9.         type = lookup($i)
  10.         if (type == 1)
  11.             print $i, "is a define"
  12.         else if (type == 2)
  13.             print $i, "is a file-scope variable"
  14.         else if (type == 4)
  15.             print $i, "is a function"
  16.         else if (type == 8)
  17.             print $i, "is an enum constant"
  18.         else if (type == 16)
  19.             print $i, "is a typedef"
  20.         else if (type == 32)
  21.             print $i, "is a struct tag"
  22.         else if (type == 64)
  23.             print $i, "is a union tag"
  24.         else if (type == 128)
  25.             print $i, "is an enum tag"
  26.         else if (type == 0)
  27.             print $i, "is something else"
  28.         else
  29.             print $i, "not looked up"
  30.         }
  31.     }